<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOauthUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oauth_user', function (Blueprint $table) {
            $table->increments('id')->comment('表自增ID');
            $table->integer('user_id')->nullable(false)->comment('用户表ID');
            $table->string('openid')->nullable(false)->comment('第三方开放平台openid');
            $table->string('oauth')->nullable(false)->comment('第三方授权平台');
            $table->string('unionid')->default('')->comment('unionid');
            $table->string('oauth_child')->default('')->comment('mp标识来自公众号, open标识来自开放平台,用于标识来自哪个第三方授权平台, 因为同是微信平台有来自公众号和开放平台');
            $table->string('nick_name')->default('')->comment('绑定时的昵称');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('oauth_user');
    }
}
